<?php
/**
 * 路由的定义
 */

use think\facade\Route;
Route::get('think', function () {
    return 'hello,ThinkPHP5!';
});
//api版本控制
Route::get('api/:version/:controller/:function','api/:version.:controller/:function');
return [
    '__pattern__' => [
        'name' => '\w+',
    ],
    '[hello]'     => [
        ':id'   => ['index/hello', ['method' => 'get'], ['id' => '\d+']],
        ':name' => ['index/hello', ['method' => 'post']],
    ],

];
////Route::快捷方法名('路由表达式','路由地址');
//Route::get('new/:id','News/read'); // 定义GET请求路由规则
//Route::post('new/:id','News/update'); // 定义POST请求路由规则
//Route::put('new/:id','News/update'); // 定义PUT请求路由规则
//Route::delete('new/:id','News/delete'); // 定义DELETE请求路由规则
//Route::any('new/:id','News/read'); // 所有请求都支持的路由规则
//Route::get('hello/:name', 'index/hello');
////定义index里面的链接
//
//
//// 注册路由到index模块的News控制器的read操作
////Route::rule('自定义的字母/:参数','模块/控制器/方法');
//Route::rule('demo/:name','Index/demo');//Route::get('demo','index/index/demo')  是一样的效果 :name是传递的参数 多个参数
//Route::rule('index','index/index/index');
//Route::rule('getInfo','index/index/getInfo');
//Route::rule('city/:name','Index/:name');//空操作的时候:name获取url里面name的参数
//// 注册路由到index模块的News控制器的read操作(可以这只别名)
//Route::rule('new/:id','index/News/read')->name('new_read');//用法:url('new_read',['id'=>10]);
////Route::get('demo/:name',function ($name){return 'Hello,' . $name;});
//
//// 给index控制器设置快捷路由
////Route::controller('index','index/index/index');
//// blog子域名绑定到blog模块
//Route::domain('blog', 'blog');
//
//// 完整域名绑定到admin模块
//Route::domain('admin.thinkphp.cn', 'admin');
//
//// IP绑定到admin模块
//Route::domain('114.23.4.5', 'admin');
//// 绑定泛二级域名域名到book模块
////Route::domain('*', 'book');
//// 绑定泛三级域名到user模块
////Route::domain('*.user', 'user?name=*');
//// 绑定域名到Response对象
////Route::domain('test', response()->code(404));
//Route::domain('blog', function () {
//    // 动态注册域名的路由规则
//    Route::rule('new/:id', 'index/news/read');
//    Route::rule(':user', 'index/user/info');
//})->append(['app_id'=>1]);
//
//
////后台链接匹配
//Route::rule('admin','admin/index/index');
//
//
////路由的中间件
//Route::rule('index/:name','hello')
//    ->middleware('Check');
return [

];
